package club.kingyin.kyblogprouser.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import club.kingyin.commons.entity.user.Log;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Select;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

/**
 * (Log)表数据库访问层
 *
 * @author makejava
 * @since 2022-01-20 15:04:02
 */
public interface LogDao extends BaseMapper<Log> {

    @Select("select params, timestamp from ky_blog_user.log where ID in(select max(ID) from ky_blog_user.log where userId = ${userId} and url = '${url}' group by params) and userId = ${userId} and url = '${url}' order by timestamp desc limit 12")
    List<Log> selectDistinctPramsByUserIdAndUrl(int userId, String url);

    @Select("select params, timestamp, userId from  ky_blog_user.log where userId = ${userId} and url = '${url}' order by timestamp desc limit 50")
    List<Log> selectPramsByUserIdAndUrl(int userId, String url);
}

